package com.bosssoft.ct.springcloud.pojo.entity;

import lombok.*;

import java.util.Objects;
import java.util.Set;

/**
 * @author ChenTong
 * @version 1.0
 * @description 用户实体类
 * @date 2020/6/21 15:59
 * @modified
 **/
public class User extends BaseEntity{
    // 用户名
    private String username;
    // 密码
    private String password;
    // 手机号码
    private String mobile;
    // 状态
    private Boolean state;
    // 邮件
    private String email;
    // 用户角色集
    private Set<Role> roles;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Boolean getState() {
        return state;
    }

    public void setState(Boolean state) {
        this.state = state;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Set<Role> getRoles() {
        return roles;
    }

    public void setRoles(Set<Role> roles) {
        this.roles = roles;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        User user = (User) o;
        return Objects.equals(username, user.username) &&
                Objects.equals(password, user.password) &&
                Objects.equals(mobile, user.mobile) &&
                Objects.equals(state, user.state) &&
                Objects.equals(email, user.email) &&
                Objects.equals(roles, user.roles);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), username, password, mobile, state, email, roles);
    }
}
